<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>未完成</title>
</head>
<body>
    
</body>
<script>
    /*
    封装为一个函数，函数参数为传入的字符串
    返回值为对象结构
    */
    var searchStr = "?id=10&page=12";
    searchStr = searchStr.slice(1);
    var arr = searchStr.split('&');
    for(var i =0;i<arr.length;i++){
        var childArr = arr[i].split("=")
        obj[childArr[0]] = childArr[i];
    }
    console.log(obj);
</script>
</html>